package freqAlphabets;

public class Solution {
    public String freqAlphabets(String s) {
        StringBuilder sb = new StringBuilder();
        int i = 0,n = s.length();
        while (i<n){
            if(i+2<s.length()&&s.charAt(i+2)=='#'){
                //   System.out.println(s.substring(i,i+2));
                sb.append((char)( Integer.parseInt(s.substring(i,i+2))-1+'a'));
                i+=3;
            } else {
                sb.append((char) (Integer.parseInt(s.charAt(i)+"")-1+'a'));
                i++;
            }
        }
        return sb.toString();
    }
}
